export default{
    namespaced:true,
    state:{
        indexTitle:true,
        listTitle:false,
        detailTitle:false,
        textTitle:false
    },
    mutations:{
        changeTitle(state,payload){
            let list =['shopcar','login','register','me'];
            if(list.includes(payload)){
                    state.indexTitle=false;
                    state.listTitle=false;
                    state.detailTitle=false;
                    state.textTitle=true
            }else{
                switch(payload){
                    case 'index':
                        state.indexTitle=true;
                        state.listTitle=false;
                        state.detailTitle=false;
                        state.textTitle=false
                        break;
                        case 'list':
                            state.indexTitle=false;
                            state.listTitle=true;
                            state.detailTitle=false;
                            state.textTitle=false
                        break;
                        case 'detail':
                            state.indexTitle=false;
                            state.listTitle=false;
                            state.detailTitle=true;
                            state.textTitle=false
                        break;
                        default:
                            state.indexTitle=false;
                            state.listTitle=false;
                            state.detailTitle=true;
                            state.textTitle=false
                            break
                }
            }
          
        }
    },
    actions:{
        changeTitle(context,payload){
            context.commit('changeTitle',payload)
        }
    }
}